<template>
    <div id="App">
        <keep-alive>
            <component :is="component" :user="user" @updateCom="updateCom"></component>
        </keep-alive>
    </div>
</template>

<script>
    import HomeCom from './HomeCom.vue'
    import ResultCom from './ResultCom.vue'
    import TopicCom from './TopicCom.vue'
    export default {
        data () {
            return {
                user: { name: "王丽圆", photo: require('../img/photo.png') },
                component: "HomeCom"
            }
        },
        methods: {
            updateCom(val) {
                this.component = val
            }  
        },
        components: {
            HomeCom,
            ResultCom,
            TopicCom
        }
    }
</script>

<style lang="less">
    body {
        font-size: 16px;
        font-family: Arial, Helvetica, sans-serif;
    }
</style>